from app.exts import db
from app.models.po.base_po import BasePO

class HanFanIntegrationPO(db.Model, BasePO):
    __tablename__ = "hanfan_integration"
    __bind_key__ = "serve_engine"
    id = db.Column(db.Integer, primary_key=True)
    create_time = db.Column(db.DateTime())
    date_time = db.Column(db.DateTime())
    actual_v = db.Column(db.FLOAT())
    predict_v = db.Column(db.FLOAT())
    actual_v_last_hour = db.Column(db.FLOAT())
    predict_v_last_hour = db.Column(db.FLOAT())
    best_v = db.Column(db.Float())
    shoude_v = db.Column(db.Float())
    operation_iron = db.Column(db.TEXT())
    actual_r2 = db.Column(db.Float())
    predict_r2 = db.Column(db.Float())
    actual_mg_al = db.Column(db.Float())
    predict_mg_al = db.Column(db.Float())
    actual_tio2 = db.Column(db.Float())
    predict_tio2 = db.Column(db.Float())
    operation_slag = db.Column(db.TEXT())

class HanfanIntegrationOperation(db.Model, BasePO):
    __tablename__ = "hanfan_integration_operation"
    __bind_key__ = "serve_engine"
    id = db.Column(db.Integer, primary_key=True)
    key = db.Column(db.VARCHAR(64))
    status = db.Column(db.VARCHAR(32))
    recommend = db.Column(db.VARCHAR(64))
    hanfan_integration_id = db.Column(db.Integer)
    type = db.Column(db.VARCHAR(8))



if __name__ == '__main__':
    # 创建数据表
    from sqlalchemy import create_engine, Integer, String, Float
    from sqlalchemy.orm import sessionmaker
    from sqlalchemy.ext.declarative import declarative_base
    from sqlalchemy import Column

    engine = create_engine("mysql+pymysql://root:Luck158,@10.8.0.2:3306/hblg?charset=utf8")
    Session = sessionmaker(bind=engine)
    HanfanIntegrationOperation.metadata.create_all(engine)